# 以下操作基于openeuler-20.03操作系统, docker版本18.09
yum install -y docker

# 下载基础镜像
wget https://repo.huaweicloud.com/openeuler/openEuler-20.03-LTS-SP3/docker_img/update/2023-09-09/aarch64/openEuler-docker.aarch64.tar.xz  --no-check-certificate
# 解压
xz -d openEuler-docker.aarch64.tar.xz

docker load -i openEuler-docker.aarch64.tar
# todo: 版本通过环境变量指定, 不要写死
wget https://github.com/git-lfs/git-lfs/releases/download/v3.1.2/git-lfs-linux-arm64-v3.1.2.tar.gz --no-check-certificate
wget https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0.tar.gz --no-check-certificate

docker build -f Docker_Base --tag mindspore_base:v1 .

cd build_mindspore_py39目录
wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz --no-check-certificate --no-check-certificate

# CANN包和mindspore, mindspore_lite包自行下载

docker build -f Dockerfile_py39 --tag mindspore_py39:v1 .


# >>>----------------------
# 镜像更新参考，
cd ../docker_update
# 把容器里面Python和ascend-toolkit复制到当前目录
docker build -f Dockerfile_update --tag mindspore:v2

# modelarts镜像，把npu-smi命令也复制到当前目录
docker build -f Dockerfile_update_modelarts --tag mindspore_modelarts:v2

# modelarts镜像没有装moxing包，训练代码目录新建ma-pre-start.sh，内容如下
pip install pip --ugrade && pip install /home/ma-user/modelarts/package/moxing_framework*.whl

